#include "pecc.h"

extern int (*old_ecdsa_do_verify)(const unsigned char *dgst, int dgst_len, 
			const ECDSA_SIG *sig, EC_KEY *eckey);

#include<unistd.h>
#include<omp.h>

void omphello() {
int nthreads, tid;

/* Fork a team of threads giving them their own copies of variables */
#pragma omp parallel private(nthreads, tid)
  {

  /* Obtain thread number */
  tid = omp_get_thread_num();
//  fprintf(stderr,"OMP_TEST SIGNING from thread = %d!\n",tid);
  printf("OMP_TEST SIGNING from thread = %d!\n",tid);
//  sleep(1);

  /* Only master thread does this */
  if (tid == 0) 
    {
    nthreads = omp_get_num_threads();
//    fprintf(stderr, "OMP_TEST: Number of threads = %d\n", nthreads);
    printf("OMP_TEST: Number of threads = %d\n", nthreads);
    }

  }  /* All threads join master thread and disband */

}


int sleep1_test(const unsigned char *dgst, int dgst_len, 
			const ECDSA_SIG *sig, EC_KEY *eckey) {
	int i;
	omphello();
	return((*old_ecdsa_do_verify)(dgst,dgst_len, 
			sig, eckey));
}

